loadin=function(){
	let t=document.getElementById('jbm');
	t.value=(0).toFixed(2);
	t=t.value;
	let t1=(t*0.08).toFixed(2);
			let t2=(t*0.02+3).toFixed(2);
			let t3=(t*0.005).toFixed(2);
			let t4=(t*0.08).toFixed(2);
			let t5=(t*0.02).toFixed(2);
			let t6=(t*0.01).toFixed(2);
			let tsum=Number(t)+Number(t1)+Number(t2)+Number(t3)+Number(t4)+Number(t5)+Number(t6);
			tsum=tsum.toFixed(2);
			let i1=document.getElementById('jbm1');
			let i2=document.getElementById('jtm');
			let i3=document.getElementById('wcm');
			let i4=document.getElementById('zfm');
			let i5=document.getElementById('ylm');
			let i6=document.getElementById('ylbm');
			let i7=document.getElementById('sym');
			let sum=document.getElementById('summ');
			i1.value=t;
			i2.value=t5;
			i3.value=t6;
			i4.value=t4;
			i5.value=t1;
			i6.value=t2;
			i7.value=t3;
			sum.value=tsum;
}
insertin=function(id,name,iID){
	let op=document.createElement("option")
	op.innerText=name;
	op.value=iID;
	let select=document.getElementById(id);
	select.appendChild(op);
}
setgz=function(){
	let k=document.getElementById('jbm');
	k.onchange=function(e){
			if(!validate(e.target.value)){
				e.target.value=(0).toFixed(2);
			}else{
				e.target.value=(e.target.value - 0).toFixed(2);	
			}
			let t=e.target.value;
			if(t=="")
			t=(0).toFixed(2);
			let t1=(t*0.08).toFixed(2);
			let t2=(t*0.02+3).toFixed(2);
			let t3=(t*0.005).toFixed(2);
			let t4=(t*0.08).toFixed(2);
			let t5=(t*0.02).toFixed(2);
			let t6=(t*0.01).toFixed(2);
			let tsum=Number(t)+Number(t1)+Number(t2)+Number(t3)+Number(t4)+Number(t5)+Number(t6);
			tsum=tsum.toFixed(2);
			let i1=document.getElementById('jbm1');
			let i2=document.getElementById('jtm');
			let i3=document.getElementById('wcm');
			let i4=document.getElementById('zfm');
			let i5=document.getElementById('ylm');
			let i6=document.getElementById('ylbm');
			let i7=document.getElementById('sym');
			let sum=document.getElementById('summ');
			i1.value=t;
			i2.value=t5;
			i3.value=t6;
			i4.value=t4;
			i5.value=t1;
			i6.value=t2;
			i7.value=t3;
			sum.value=tsum;
	}
}
function validate(num)
{
  var reg = /^\d+(?=\.{0,1}\d+$|$)/
  if(reg.test(num)) return true;
  return false ;  
}
tomenoy=function(url){
	let xml;
	let t1=document.getElementById('name');
	let t2=document.getElementById('djrq');
	let t3=document.getElementById('djr');
	let i1=document.getElementById('jbm1');
	let i2=document.getElementById('jtm');
	let i3=document.getElementById('wcm');
	let i4=document.getElementById('zfm');
	let i5=document.getElementById('ylm');
	let i6=document.getElementById('ylbm');
	let i7=document.getElementById('sym');
	let i8=document.getElementById('summ');
	let id=getmomeyid1();
	if(url=="/salary/addsalary")
		id=0;
	let status=0;
	if(url=="/salary/update")
		status=1;
	if (window.XMLHttpRequest)
	{
	    //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
	    xml=new XMLHttpRequest();
	}
	else
	{
	    // IE6, IE5 浏览器执行代码
	    xml=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xml.onreadystatechange=function(){
		if(xml.readyState==4&&xml.status==200){
			let t=JSON.parse(xml.responseText);
			if(t.status==200){
				alert("成功");
				if(url=="/salary/update"){
					let mya=document.createElement('a');
					mya.href="memoysetfh.html";
					mya.click();
				}
			}
		}
	}
	xml.open("post",url,true);
	xml.setRequestHeader('content-type','application/x-www-form-urlencoded');
	xml.send('sName='+t1.value+'&sBasic='+i1.value+'&sLunch='+i3.value+'&sTransport='+i2.value+
	'&sCommunicate='+i4.value
	+'&sPension='+i5.value+'&sMedical='+i6.value+'&sUnemployment='+i7.value
	+'&sStatus='+status+'&sID='+id+'&sSum='+i8.value);
}
let getmomeyid1=function(){
	let id=decodeURI(window.location .href);
    let aa=id.indexOf('=');
    if (aa>-1){
    id=id.substring(aa+1);
    }
    return id;
}
